Page({

  /**
   * 页面的初始数据
   */
  data: {
    videoSrc: [],
    mone: true,
    tue: false,
    wed: false,
    thur: false,
    fri: false,
    sat: false,
    sun: false,
    videoSrc1: [],
    date: "moneday",
    currentData:"0"
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this;
    wx.request({
      url: 'http://localhost:8080/myServlet/connection',
      success(res) {
        that.setData({
          videoSrc: res.data
        })
      }
    })
    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=moneday',
      success(res) {
        that.setData({
          videoSrc1: res.data
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  },
  bindchange: function(e) {
    const that = this;
    that.setData({
      currentData: e.detail.current
    })
  },
  //点击切换，滑块index赋值
  checkCurrent: function(e) {
    const that = this;
    if (that.data.currentData === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentData: e.target.dataset.current
      })
    }
  },

  toSearch: function() {
    wx.navigateTo({
      url: '../search/search',
    })
  },

  choseWeak: function() {
    var that = this
    if (that.data.mone == false) {
      that.setData({
        mone: true,
        tue: false,
        wed: false,
        thur: false,
        fri: false,
        sat: false,
        sun: false,
      })
    } else {
      that.setData({
        mone: false
      })
    }

    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=moneday',
      success(res){
        that.setData({
          videoSrc1:res.data
        })
      }
    })
    // console.log(this.data.mone)
  },
  choseWeak1: function() {
    var that = this
    if (that.data.tue == false) {
      that.setData({
        mone: false,
        tue: true,
        wed: false,
        thur: false,
        fri: false,
        sat: false,
        sun: false,
      })
    } else {
      that.setData({
        tue: false
      })
    }
    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=tuesday',
      success(res) {
        that.setData({
          videoSrc1: res.data
        })
      }
    })
    // console.log(this.data.mone)
  },
  choseWeak2: function() {
    var that = this
    if (that.data.wed == false) {
      that.setData({
        mone: false,
        tue: false,
        wed: true,
        thur: false,
        fri: false,
        sat: false,
        sun: false,
        
      })
    } else {
      that.setData({
        wed: false
      })
    }
    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=wednesday',
      success(res) {
        that.setData({
          videoSrc1: res.data
        })
      }
    })
    // console.log(this.data.mone)
  },
  choseWeak3: function() {
    var that = this
    if (that.data.thur == false) {
      that.setData({
        mone: false,
        tue: false,
        wed: false,
        thur: true,
        fri: false,
        sat: false,
        sun: false
      })
    } else {
      that.setData({
        thur: false
      })
    }
    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=thursday',
      success(res) {
        that.setData({
          videoSrc1: res.data
        })
      }
    })
    // console.log(this.data.mone)
  },
  choseWeak4: function() {
    var that = this
    if (that.data.fri == false) {
      that.setData({
        mone: false,
        tue: false,
        wed: false,
        thur: false,
        fri: true,
        sat: false,
        sun: false
      })
    } else {
      that.setData({
        fri: false
      })
    }
    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=firday',
      success(res) {
        that.setData({
          videoSrc1: res.data
        })
      }
    })
    // console.log(this.data.mone)
  },
  choseWeak5: function() {
    var that = this
    if (that.data.sat == false) {
      that.setData({
        mone: false,
        tue: false,
        wed: false,
        thur: false,
        fri: false,
        sat: true,
        sun: false
      })
    } else {
      that.setData({
        sat: false
      })
    }
    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=saturday',
      success(res) {
        that.setData({
          videoSrc1: res.data
        })
      }
    })
    // console.log(this.data.mone)
  },
  choseWeak6: function() {
    var that = this
    if (that.data.sun == false) {
      that.setData({
        mone: false,
        tue: false,
        wed: false,
        thur: false,
        fri: false,
        sat: false,
        sun: true
      })
    } else {
      that.setData({
        sun: false
      })
    }
    wx.request({
      url: 'http://localhost:8080/myServlet/connectiontwo?date=sunday',
      success(res) {
        that.setData({
          videoSrc1: res.data
        })
      }
    })
    // console.log(this.data.mone)
  }
})